package com.guangdujs.kis.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.guangdujs.common.annotation.Log;
import com.guangdujs.common.core.controller.BaseController;
import com.guangdujs.common.core.domain.AjaxResult;
import com.guangdujs.common.enums.BusinessType;
import com.guangdujs.kis.domain.TUserLogin;
import com.guangdujs.kis.service.ITUserLoginService;
import com.guangdujs.common.utils.poi.ExcelUtil;
import com.guangdujs.common.core.page.TableDataInfo;

/**
 * 用户登录Controller
 * 
 * 
 * @date 2022-11-04
 */
@RestController
@RequestMapping("/kis/Login")
public class TUserLoginController extends BaseController
{
    @Autowired
    private ITUserLoginService tUserLoginService;

    /**
     * 查询用户登录列表
     */
    @PreAuthorize("@ss.hasPermi('kis:Login:list')")
    @GetMapping("/list")
    public TableDataInfo list(TUserLogin tUserLogin)
    {
        startPage();
        List<TUserLogin> list = tUserLoginService.selectTUserLoginList(tUserLogin);
        return getDataTable(list);
    }

    /**
     * 导出用户登录列表
     */
    @PreAuthorize("@ss.hasPermi('kis:Login:export')")
    @Log(title = "用户登录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TUserLogin tUserLogin)
    {
        List<TUserLogin> list = tUserLoginService.selectTUserLoginList(tUserLogin);
        ExcelUtil<TUserLogin> util = new ExcelUtil<TUserLogin>(TUserLogin.class);
        util.exportExcel(response, list, "用户登录数据");
    }

    /**
     * 获取用户登录详细信息
     */
    @PreAuthorize("@ss.hasPermi('kis:Login:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tUserLoginService.selectTUserLoginById(id));
    }

}
